package com.lsh.streamgd.utils;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.util.FileManager;
import com.lsh.streamgd.sparql.OWLParserSparql;
import com.lsh.streamgd.sparql.Upload;
import com.lsh.streamgd.sparql.impl.OWLParserSparqlImpl;
import de.fuberlin.wiwiss.d2rq.jena.ModelD2RQ;
import virtuoso.jena.driver.VirtGraph;

import java.util.List;

public class Test {
    public static void main(String[] args) {
//        Upload upload = new Upload();
//        upload.convert2RDF("file:e://result.ttl", "http://www.usources.cn/resource/sibs/");

//        String url = "jdbc:virtuoso://45.78.35.217:1111";
//
//        VirtGraph graph = new VirtGraph ("http://seminfo.com.cn/graph/semtest", url, "SemTest", "SemTest");
//        graph.getCount();
//        //转换RDF数据
//        Model m = new ModelD2RQ("file:e://result.ttl", "N3", "http://www.usources.cn/resource/sibs/");
//        m.write(System.out, "N3");
//        m.close();
//
//        //解析TTL文件，原始Model
//        Model assemblerSpec = FileManager.get().loadModel("file:d:/d2rq-0.8.1/mappings-1.ttl", "http://www.seminfo.com.cn/agent/abc/", "TTL");
//
//        OWLParserSparql owl = new OWLParserSparqlImpl(assemblerSpec);

        //获取所有表和conference表的字段
//        List list = owl.getAllTables();
//        List list = owl.getColumns("http://www.seminfo.com.cn/abc/vocab/conferences");
//        System.out.println(list);

        //添加comment
//        owl.insertComment("http://www.seminfo.com.cn/abc/vocab/conferences_ConfID", "会议记录号");
//        System.out.println(assemblerSpec.size());
//        assemblerSpec.write(System.out, "N3");

//        assemblerSpec.listStatements().toList();
//        Map<String, String> ns_map = assemblerSpec.getNsPrefixMap();
//
//        String query = StringUtil.getNsPrefixString(ns_map) +
//                "SELECT * WHERE {?s a rdfs:Class}";
//
//        ArrayList results = SparqlExecution.jQuery(assemblerSpec, query, "s");
//        System.out.println(results);
//
//        assemblerSpec.close();
    }
}
